﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using UTC_Project_Manager.Model;
using DlhSoft.Windows.Data;
using UTC_Project_Manager.Model.Infrastructure;

namespace UTC_Project_Manager.Controls
{
    /// <summary>
    /// Interaction logic for MemberListControl.xaml
    /// </summary>
    public partial class MemberListControl : UserControl
    {
        private Config config;

        public MemberListControl()
        {
            InitializeComponent();
            config = App.MyConfig;
            this.nameListView.ItemsSource = App.MyConfig.OurProject.Members;
            //this.nameListView.ItemsSource = config.assignableResourceItems;
        }

        private void nameListView_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            this.membersDetailGrid.Children.Clear();
            if (this.nameListView.SelectedIndex != -1)
            {
                GroupBox box = new GroupBox();
                box.FontSize = 14;
                Member currentMember = this.nameListView.SelectedItem as Member;
                box.Header = currentMember.ToString();
                box.Content = "Tel: " + currentMember.Phone + "\r\n" + "Email: " + currentMember.Email;
                this.membersDetailGrid.Children.Add(box);
            }
            
        }
    }
}
